import axios from "@/utils/request";

// ==================== 虚拟仿真实验资源管理 ====================

/**
 * 虚拟仿真实验分页查询
 */
export function simulationResourcePage(params) {
  return axios.get(`/simulation/resource/page`, { params });
}

/**
 * 虚拟仿真实验列表查询
 */
export function listResource(params) {
  return axios.get(`/simulation/resource`, { params })
}

/**
 * 虚拟仿真实验详情
 */
export function getSimulationResource(resourceId) {
  return axios.get(`/simulation/resource/${resourceId}`);
}

/**
 * 新增虚拟仿真实验
 */
export function saveSimulationResource(data) {
  return axios.post(`/simulation/resource`, data);
}

/**
 * 更新虚拟仿真实验
 */
export function updateSimulationResource(data) {
  return axios.put(`/simulation/resource`, data);
}
// 更新资源 
export function updateResources(data) {
  return axios.post(`/simulation/resource/updateResource`, data);
}

/**
 * 删除虚拟仿真实验
 */
export function removeSimulationResource(resourceId) {
  return axios.delete(`/simulation/resource/${resourceId}`);
}

/**
 * 检查虚拟仿真实验 code 是否可用
 */
export function checkCode(code, id) {
  return id ? axios.get(`/simulation/resource/check/${id}/${code}`) : axios.get(`/simulation/resource/check/${code}`)
}


/**
 * 获取仿真实验更新记录
 */
export function getUpdateRecord(params) {
  return axios.get(`/simulation/resource/updateRecord`,{ params });
}
/**
 * 获取仿真实验反馈
 */
export function simulationFeedbackList(params) {
  return axios.get(`/simulation/resource/backRecord`,{ params });
}
/**
 * 获取仿真实验访问记录
 */
export function simulationOpenList(params) {
  return axios.get(`/simulation/record/users`,{ params });
}
/**
 * 启用/禁用实验
 */
export function simulationState(params) {
  return axios.get(`/simulation/resource/changeState`,{ params });
}

// ==================== 虚拟仿真实验考核管理 ====================

/**
 * 考核列表
 */
export function getExamPage(params) {
  return axios.get(`/simulation/exam/page`, { params })
}

/**
 * 创建考核
 */
export function saveExam(data) {
  return axios.post(`/simulation/exam`, data)
}

/**
 * 删除考核
 */
export function removeExam(examId) {
  return axios.delete(`/simulation/exam/${examId}`)
}

/**
 * 更新考核状态
 */
export function changeExamStatus(examId, state) {
  return axios.put(`/simulation/exam/${examId}/${state}`)
}

/**
 * 考核完成情况
 */
export function getPaperPage(params) {
  return axios.get(`/simulation/tVrPaperDO/page`, { params })
}

// ==================== 页面操作支持接口(参数列表获取等) ====================

/**
 * 虚拟仿真实验资源使用模式
 */
export function listResourceMode() {
  return axios.get(`/sys/sysDictreeDO/listByParam`, { params: { type: "vr_mode" } })
}

/**
 * 根据父 id 列举专业类别
 */
export function listMajorByPid(pid) {
  return axios.get(`/major/majormainDO/list`, { params: { pid: pid || 0 } })
}

/**
 * 专业类别树
 */
export function majorTree() {
  return axios.get(`/major/majormainDO/`)
}

/**
 * 根据组织机构 id 获取组织机构树
 */
export function getDeptTreeById(id) {
  return axios.get(`/sys/dept/tree/${id}`)
}

/**
 * 根据组织机构获取用户列表, 不分页
 */
export function listUserByDept(data) {
  return axios.get(`/sys/user/studentList`, { params: data })
}

export function resourcePower(data) {
  return axios.post(`/simulation/vrResourceUserDO/resourcePower`, data)
}
export function resourceUser(data) {
  return axios.get(`/simulation/vrResourceUserDO/resourceUser`,  { params: data })
}
/**
 * 回复实验反馈
 */
export function saveBack(data) {
  return axios.post(`/simulation/resource/saveBack`, data)
}



/**
 * 回复实验反馈
 */

export function getvrExamineRecord(data) {
  return axios.get(`/simulation/vrExamineRecord/list`, { params: data })
}
/**
 * 回复实验反馈
 */

export function getvrExaminedetails(data) {
  return axios.get(`/simulation/vrExamineRecord/details`, { params: data })
}


